import {
  defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'
import {
  resolve
} from 'path'
// 打包后页面直接显示
import legacy from '@vitejs/plugin-legacy';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), legacy({
    targets: ['defaults', 'not IE 11'],
  }), ],
  base: './',
  host: '127.0.0.1',
  port: 5154,
  css:{
    // css预处理器
    preprocessorOptions:{
      less:{
        charset:false,
        additionlData:'@import "./src/assets/css/global.less"',
      }
    }
  },
  manifest: true, //配置后才能让编译后的vue路径被正确识别
  resolve: {
    alias: {
      '@': resolve(__dirname, './src')
    }
  },
  optimizeDeps: {
    exclude: ['electron'], // 告诉 Vite 排除预构建 electron，不然会出现 __diranme is not defined
  }
})